package com.hollycrm.unicom.logsupport.hibernate;

import org.springframework.orm.hibernate.HibernateTemplate;
import org.springframework.orm.hibernate.support.HibernateDaoSupport;

import com.hollycrm.unicom.logsupport.LogManager;
import com.hollycrm.unicom.logsupport.LogObject;
import com.hollycrm.unicom.logsupport.OperationLog;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2004</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */

public class HibernateOperationLogManager
    extends HibernateDaoSupport
    implements LogManager {
    public HibernateOperationLogManager() {
    }

    /**
     * updateLog
     *
     * @param logObject LogObject
     * @return LogObject
     */
    public LogObject updateLog(LogObject logObject) {
        throw new UnsupportedOperationException("no implemention this method.");
    }

    /**
     * writeLog
     *
     * @param logObject LogObject
     * @return LogObject
     */
    public LogObject writeLog(LogObject logObject) {
        HibernateTemplate ht = getHibernateTemplate();
        OperationLog operationLog = (OperationLog) logObject;
        operationLog.checkNull();
        ht.save(operationLog);
        return operationLog;
    }

}
